package com.superzqb.asus.superzqbFragment.superzqbSave;

import android.content.Intent;
import android.os.Bundle;
import android.test.suitebuilder.TestMethod;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

import com.superzqb.asus.superzqb.R;
import com.superzqb.asus.superzqbActivity.BaseActivity;
import com.superzqb.asus.superzqbUtil.RoundImageView;

import static com.superzqb.asus.superzqbFragment.superzqbSave.AddAim.buyFlag;
import static com.superzqb.asus.superzqbFragment.superzqbSave.AddAim.myAimFlag;
import static com.superzqb.asus.superzqbFragment.superzqbSave.AddAim.saveFlag;
import static com.superzqb.asus.superzqbFragment.superzqbSave.AddAim.tripFlag;

public class FinishMyAimActivity extends BaseActivity implements View.OnClickListener{
    private TextView title,goods,aimMoney,must;
    private ImageView back;
    private Intent intent;
    private RoundImageView pic;
    private static int  type;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_finish_my_aim);
        initView();
    }

    private void initView() {
        context=FinishMyAimActivity.this;
        intent=getIntent();
        type=intent.getIntExtra("flag",buyFlag);
        pic=(RoundImageView) findViewById(R.id.pic);
        title=(TextView)findViewById(R.id.title);
        chooseTitle(type);

        back=(ImageView) findViewById(R.id.back);

        goods=(TextView)findViewById(R.id.goods);
        aimMoney=(TextView)findViewById(R.id.aimMoney);
        must=(TextView)findViewById(R.id.must);

        goods.setText("目标商品："+intent.getStringExtra("goods"));
        aimMoney.setText("目标金额："+intent.getStringExtra("money")+" (元)");
        must.setText("攒钱次数："+intent.getIntExtra("finish",-1)+" (次)");
        back.setOnClickListener(this);
    }
    private void chooseTitle(int flag) {
        switch (flag){
            case buyFlag:
                pic.setBackground(getResources().getDrawable(R.mipmap.aim1));
                break;
            case tripFlag:
                pic.setBackground(getResources().getDrawable(R.mipmap.aim2));
                break;
            case saveFlag:
                pic.setBackground(getResources().getDrawable(R.mipmap.aim3));
                break;
            case myAimFlag:
                pic.setBackground(getResources().getDrawable(R.mipmap.aim4));
                break;
        }
        title.setText("目标已生成");
    }
    @Override
    public void onClick(View v) {
        switch (v.getId()){
            case R.id.back:
                finish();
                break;
            default:break;
        }
    }
}
